package com.ctrip.corp.obt.shard.sql.parser;

import org.apache.ibatis.session.Configuration;

import com.ctrip.corp.obt.shard.utils.PluginUtils.DSBoundSql;

/**
 * 用于获取预编译参数的取值的公共请求接口
 *
 * @author xukang zhang
 * @date 2024/3/8 13:24
 */
public interface IPluginPropertyParserRequest {
    /**
     * 获取将mybatis的BoundSql封装成的DSBoundSql
     * 
     * @return
     */
    DSBoundSql getBoundSql();

    /**
     * 获取mybatis的Configuration
     * 
     * @return
     */
    Configuration getConfiguration();

    /**
     * 验证参数是否合法 (true: 合法)
     * 
     * @return
     */
    static boolean validate(IPluginPropertyParserRequest request) {
        return request != null && request.getBoundSql() != null
            && request.getConfiguration() != null;
    }
}
